package cn.bdqn.repository;

import cn.bdqn.pojo.Audit;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * 审计机构接口
 */
public interface Asecu_AuditRepository extends JpaRepository<Audit,Integer> {

    void deleteByParent(@Param("parent") Integer parent);

    @Query(value = "UPDATE audit  SET code=:code,audit_name = :audit_name WHERE id = :id ", nativeQuery = true)
    @Modifying
    void modify(@Param("code") String code,@Param("audit_name")String audit_name,@Param("id")int id);

    List<Audit> findAll(Specification<Audit> spec);
}
